import yaml

# 1.yaml对象
# with open('my_yaml.yml','r',encoding='utf-8') as f:
#     data = yaml.load(f,Loader=yaml.FullLoader)
#     print(data)
#     print(data['url'])
#     print(data['ip'])


# 2.yaml数组
# with open('my_yaml_2.yaml','r',encoding='utf-8') as f:
#     data = yaml.load(f,Loader=yaml.FullLoader)
#     print(data)


# 3.yaml复合结构
with open('my_yaml_3.yaml', 'r', encoding='utf-8') as f:
    data = yaml.load(f, Loader=yaml.FullLoader)
    print(data)
    print(data['websites']['URL'])
    print(data['websites']['IP'])
    print(data['websites']['Port'])
